package com.example.library.config;

import com.example.library.interceptor.Libinterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;

@Configuration

public class LibConfig implements WebMvcConfigurer {
    @Bean
    public Libinterceptor myInterceptor(){
        return new Libinterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(new Libinterceptor()).addPathPatterns("/**")
                .addPathPatterns("/**")
                .excludePathPatterns("/library","/library/login","/library/tologin","/library/user");
    }


}
